/*
 * Copyright (C) 2010 Seapeak.Xu
 *
 * fostmq may be copied only under the terms of the GNU General
 * Public License V3, which may be found in the fostmq source kit.
 *
 * Created on: 2010-8-18
 * Author: Seapeak.Xu
 */

#ifndef FOST_MSG_H_
#define FOST_MSG_H_
#ifdef __cplusplus
extern "C"
{
#endif

#include <stdint.h>

#include "fost_typedef.h"

typedef enum session_type
{
	unspecified, header, body,
} session_t;

typedef struct header_type
{
	char protocol;
	int state;
	int64_t bodylen;
} header_t;

#ifndef HEADERLEN
#define HEADERLEN sizeof(char) + sizeof(int) + sizeof(int64_t)
#endif

int buff2header(header_t *header, const char *buff);
int header2buff(const header_t *header, char *buff);

#ifdef __cplusplus
}
#endif
#endif /* FOST_MSG_H_ */
